
#include<allegro5/allegro_primitives.h>
#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

int main() {
	const int mapStartX=10,mapStartY=10, fieldWidth=20;
	cout << "Podaj nazwe pliku z zapisem mapy: " << endl; // prints !!!Hello World!!!
	string filename="";
	cin>>filename;
	ifstream file;
	file.open(filename.c_str());

	cout<<"att, occ czy visits?";
	string decision;
	cin>>decision;
	al_init();
	al_init_primitives_addon();
	ALLEGRO_DISPLAY* display;
	display = al_create_display(1000,1000);
	if(decision=="att" || decision=="occ")
	{
		vector <vector<double> > map;
		int m,n;
		file>>m>>n;
		cout<<m<<" "<<n;
		map.resize(m,vector<double>(n,0.0));
		al_clear_to_color(al_map_rgb(255,255,255));
		for(int y=0;y<m;y++)
		{
			for(int x=0;x<n;x++)
			{
				file>>map[y][x];
				ALLEGRO_COLOR color;
				if(decision=="att")
				{
					color=al_map_rgb(255*(1-map[y][x]),255*(1-map[y][x]),255*(1-map[y][x]));
				}
				else
				{
					color=al_map_rgb(0,map[y][x]*255,0);
				}
				al_draw_filled_rectangle(x*fieldWidth,y*fieldWidth,(x+1)*fieldWidth,(y+1)*fieldWidth,color);
			}
		}
		al_flip_display();
		cout<<"wyswietlono";
	}
	char c;
	cin>>c;
//	else if(decision=="visits")
//	{
//		vector <vector<double> > map;
//				int m,n;
//				file>>m>>n;
//				map.resize(m,vector<double>(n,0.0));
//				for(int y=0;y<m;y++)
//				{
//					for(int x=0;x<n;x++)
//					{
//						file>>map[y][x];
//						ALLEGRO_COLOR color;
//						if(decision=="att")
//						{
//							color=al_map_rgb(255*(1-map[y][x]),255*(1-map[y][x]),255*(1-map[y][x]));
//						}
//						else
//						{
//							color=al_map_rgb(0,map[y][x]*255,0);
//						}
//						al_draw_filled_rectangle(x*fieldWidth,y*fieldWidth,(x+1)*fieldWidth,(y+1)*fieldWidth,color)
//					}
//				}
//				al_flip_display();
//	}
	return 0;
}
